package com.yx.study.leet.primary.arrary;

/**
 * 验证回文串
 * https://leetcode.cn/leetbook/read/top-interview-questions-easy/xne8id/
 *
 * */
public class IsPalindrome {
    public boolean isPalindrome(String s) {
        String actual = s.replaceAll("[^A-Za-z0-9]", "").toLowerCase();
        String rev = new StringBuffer(actual).reverse().toString();
        return actual.equals(rev);
    }

    public static void main(String[] args) {
        String s = "ABCRsdn000#@#$%%";
        String actual = s.replaceAll("[^A-Za-z0-9]", "").toLowerCase();
        System.out.println(actual);
    }
}
